<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$Think.lang.goods_list}-{$tpshop_config['shop_info_store_title']}</title>
  <meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
  <meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
</head>

<body>
<!--------頭部開始-------------->
<include file="Public/header" />
<!--------頭部結束-------------->
<link rel="stylesheet" type="text/css" href="__STATIC__/css/homehtmleaf-demo.css">
<link rel="stylesheet" href="__STATIC__/css/page.css" type="text/css">
<link rel="stylesheet" href="__STATIC__/css/category.css" type="text/css">

<script type="text/javascript" src="__STATIC__/js/jquery.jqzoom.js"></script>
<script src="__PUBLIC__/js/pc_common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script><!--彈窗js 參考文檔 http://layer.layui.com/-->

<!--------中間內容-------------->
<div id="warpper" class="clearfix">

  <?php if($goods_list){ ?>

  <adv limit="1" item="v" pid="2">
    <div class="probanner" style="background:url({$v[ad_code]}) no-repeat top center;<if condition="$Think.cookie.filterstatus eq 'hide'">height:117px;background-position:0 -117px;</if>"></div>
</adv>

<div class="cata_shop_right" id="tracker_category">
  <!-- 館頁屬性 -->
  <div class="attribute_content">
    <div class="attrs" >
      <if condition="$filter_menu" >
        <div class='m-tr'  style="border-bottom: 1px solid #DFDFDF;">
          <div class='g-left'>
            <p>{$Think.lang.selectedcriteria}：</p>
          </div>
          <div class='g-right ' >
            <div class="g-list">
              <foreach name="filter_menu" item="v" key="k">
                <a title="{$v['text']}" href="{$v['href']}" class="u-av-label"><?php echo str_replace('　','',$v['text']); ?><i class="icon-cross"></i></a>
              </foreach>

            </div>
          </div>
        </div>
      </if>

      <script>
          // ajax 刪除購物車的商品
          $(function() {
              $(".showfilter,.hidefilter").click(function(){
				  
                  $.ajax({
                      type : "POST",
                      url:"{:U('Home/Goods/ajaxFilter')}",//+tab,
                      data:"", //
                      dataType:'json',
                      success: function(data){
                          if(data.status == 1)
                          {
                              //顯示
                              $("#filter_sec").slideDown(1000);
                              $(".topfilter").hide();
                              $(".bottomfilter").show();


                              $(".probanner").animate({
                                  height:"352px",
                                  backgroundPositionY:"0",
                              },1000);

                          }
                          else if(data.status == 2)
                          {
                              //隱藏頭部

                              $("#filter_sec").slideUp(1000,function(){
                                  $(".topfilter").delay(2000).show();
                                  $(".bottomfilter").hide();

                              });

                              $(".probanner").animate({
                                  height:$(".probanner").height()/3+"px",
                                  backgroundPositionY:"-"+$(".probanner").height()/3+"px",
                              },1000);
                          }
                      }
                  });
              });
          });

      </script>

      <div class="filter_state_line topfilter" <if condition="$Think.cookie.filterstatus eq 'hide'">style="display:block;"</if>><a href="javascript:void(0);" class="showfilter">展開選項<img src="__STATIC__/images/filter_down.jpg"></a></div>

    <div id="filter_sec" <if condition="$Think.cookie.filterstatus eq 'hide'">style="display:none;"</if>>
    <!--帥選品牌-->
    <if condition="$filter_brand neq null">
      <div class='m-tr'  >
        <div class='g-left'>
          <p>{$Think.lang.brand}：</p>
        </div>
        <div class='g-right ' >
          <div class="g-list">
            <ul class="f-list h76 ">
              <foreach name="filter_brand" item="v" key="k">
                <li> <a data-href="" href="{$v[href]}" data-key='brand' data-val='{$v[id]}'><i></i>{$v[name]}</a> </li>
              </foreach>
            </ul>
            <div class="f-ext">
              <a  class="f-more brandMore" data-attr="attr_600002" href="javascript:;">{$Think.lang.more}<i></i></a>
              <a  class="f-check brand" data-attr="attr_600002" href="javascript:;"><i></i>{$Think.lang.multiplechoice} </a>
            </div>
            <div class="g-btns">
              <a  href="javascript:;" class="u-confirm" onClick="submitMoreFilter('brand',this);">{$Think.lang.confirm} </a>
              <a href="javascript:;" class="u-cancel brand">{$Think.lang.cancel} </a>
            </div>
          </div>
        </div>
      </div>
    </if>
    <!--帥選規格-->
    <foreach name="filter_spec" item="v" key="k">
      <div class='m-tr' >
        <div class='g-left'>
          <p>{$v.name}：</p>
        </div>
        <div class='g-right ' >
          <div class="g-list">
            <ul class="f-list ">
              <foreach name="v[item]" item="v2" key="k2">
                <li> <a id='' data-href="" href="{$v2[href]}" data-key='{$v2[key]}' data-val='{$v2[val]}'><i></i>{$v2[item]}</a> </li>
              </foreach>
            </ul>
            <div class="f-ext">
              <a  class="f-more " data-attr="attr_601115" href="javascript:;">{$Think.lang.more} <i></i></a>
              <a  class="f-check " data-attr="attr_601115" href="javascript:;"><i></i>{$Think.lang.multiplechoice} </a>
            </div>
            <div class="g-btns">
              <a  href="javascript:;" class="u-confirm" onClick="submitMoreFilter('spec',this);">{$Think.lang.confirm} </a>
              <a href="javascript:;" class="u-cancel ">{$Think.lang.cancel} </a>
            </div>
          </div>
        </div>
      </div>
    </foreach>
    <!--價格帥選-->
    <if condition="$filter_price neq null">
      <div class='m-tr' >
        <div class='g-left'>
          <p>{$Think.lang.price}：</p>
        </div>
        <div class='g-right ' >
          <div class="g-list">
            <ul class="f-list h76 ">
              <foreach name="filter_price" item="v" key="k">
                <li> <a href="{$v[href]}" data-attr-desc=''><i></i>{$v[value]}</a> </li>
              </foreach>
              <li class="m-pricebox">
                <form action="<?php echo urldecode(U("/Home/Goods/goodsList",$filter_param,''));?>" method="post" id="price_form">
                <input type="text" class="u-pri-start" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" name="start_price" id="start_price" />
                -
                <input type="text" class="u-pri-end" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')"  name="end_price" id="end_price" />
                <span style="cursor:pointer;" class="z-btn ensure03 u-btn-pri" href="javascript:;" onClick="if($('#start_price').val() !='' && $('#end_price').val() !='' ) $('#price_form').submit();">{$Think.lang.confirm}</span>
                </form>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </if>
    <!--價格帥選 end-->
    <!--帥選屬性-->
    <foreach name="filter_attr" item="v" key="k">
      <div class='m-tr' >
        <div class='g-left'>
          <p>{$v.attr_name}：</p>
        </div>
        <div class='g-right ' >
          <div class="g-list">
            <ul class="f-list h76 ">
              <foreach name="v[attr_value]" item="v2" key="k2">
                <li> <a data-href="{$v2[href]}" href="{$v2[href]}" data-key='{$v2[key]}' data-val='{$v2[val]}'><i></i>{$v2[attr_value]}</a> </li>
              </foreach>
            </ul>
            <div class="f-ext">
              <a  class="f-more brandMore" data-attr="attr_600002" href="javascript:;">{$Think.lang.more} <i></i></a>
              <a  class="f-check brand" data-attr="attr_600002" href="javascript:;"><i></i>{$Think.lang.multiplechoice}</a>
            </div>
            <div class="g-btns">
              <a  href="javascript:;" class="u-confirm" onClick="submitMoreFilter('attr',this);">{$Think.lang.confirm} </a>
              <a href="javascript:;" class="u-cancel brand">{$Think.lang.cancel} </a>
            </div>
          </div>
        </div>
      </div>
    </foreach>

    <a  class="f-out-more" href="javascript:;" style="display: none;">{$Think.lang.more_options} <i></i></a> </div>
  <div class="filter_state_line bottomfilter" <if condition="$Think.cookie.filterstatus eq 'hide'">style="display:none;"</if> style="border-top: 1px solid #DFDFDF;">
  <a href="javascript:void(0);" class="hidefilter">{$Think.lang.put_option}<img src="__STATIC__/images/filter_top.jpg"></a>
</div>
</div>

</div>
<!-- 館頁屬性 -->

<!-- 商品列表 -->
<div class="searchbox" id="search_box_list">
  <div class="list clearfix">
    <ul class="left text12" id="order_ul">
      <!--        <li><a class="col7ac " href1="&sort=recommand&asc=0" style="cursor:pointer;">綜合</a></li>-->
      <li> <a class="col7ac  <if condition="$_GET[sort] eq ''">main</if>" href="<?php echo urldecode(U("/Home/Goods/goodsList#search_box_list",$filter_param,''));?>" style="cursor:pointer;"> {$Think.lang.productmr} </a> </li>


      <li> <a class="col7ac  <if condition="$_GET[sort] eq 'sales_sum'">main</if>" href="<?php echo urldecode(U("/Home/Goods/goodsList#search_box_list",array_merge($filter_param,array('sort'=>'sales_sum')),''));?>" style="cursor:pointer;"> {$Think.lang.productxl} </a> </li>

      <if condition="$_GET['sort_asc'] eq 'desc'">
        <li><a class="col7ac  <if condition="$_GET[sort] eq 'shop_price'">main</if>" href="<?php echo urldecode(U("/Home/Goods/goodsList#search_box_list",array_merge($filter_param,array('sort'=>'shop_price','sort_asc'=>'asc')),''));?>" style="cursor:pointer;">{$Think.lang.productjg}<span class="icon-chevron-up "></span></a></li>
      <else />
      <li><a class="col7ac  <if condition="$_GET[sort] eq 'shop_price'">main</if>" href="<?php echo urldecode(U("/Home/Goods/goodsList#search_box_list",array_merge($filter_param,array('sort'=>'shop_price','sort_asc'=>'desc')),''));?>" style="cursor:pointer;">{$Think.lang.productjg}<span class="icon-chevron-down "></span></a></li>
      </if>

      <li><a class="col7ac  <if condition="$_GET[sort] eq 'comment_count'">main</if>" href="<?php echo urldecode(U("/Home/Goods/goodsList#search_box_list",array_merge($filter_param,array('sort'=>'comment_count')),''));?>" style="cursor:pointer;">{$Think.lang.productpl}</a></li>
      <li><a class="col7ac  <if condition="$_GET[sort] eq 'is_new'">main</if>"  href="<?php echo urldecode(U("/Home/Goods/goodsList#search_box_list",array_merge($filter_param,array('sort'=>'is_new')),''));?>" style="cursor:pointer;">{$Think.lang.productxp}</a></li>
    </ul>
    <!-- Page -->
    <div class="right text12" id="pagenavi">
      <div class="all-number">
        <span>{$Think.lang.gong}{$page->totalRows}{$Think.lang.commodity} </span>
      </div>
      <p class="pageArea" data-countPage="1">
        <!--<a class="bg_img1"></a>-->
        <span class="colf22e01 fontT">{$page->nowPage}</span>
        /
        <span class="page_count fontT">{$page->totalPages}</span>
        <!--<a href="" class="bg_img2"></a> </p>-->
    </div>
    <!-- Page End-->
  </div>
  <!-- list -->
</div>
<!-- searchbox -->
<?php } ?>
<?php if(!$goods_list){ ?>
<if condition="$logo neq ''">
  <img src="{$logo}" style='margin-top:15px;'>
  <else/>
  <div id="tips_message">
    <div class="message_tipws_content">
      <div class="tips_img"><img src="__STATIC__/images/tips_message.png" ></div>
      <div class="tipws_content">
        {$Think.lang.notproducthint}
        <a href="{:U('Goods/goodsList')}">{$Think.lang.morepriduct} <i class="icon-chevron-right-circle"></i></a>
      </div>
      <div class="clear"></div>
    </div>
  </div>
</if>
<?php } ?>
<ul id="cata_choose_product" class="cart_containt clearfix listContainer">

  <foreach name="goods_list" item="v" key="k">

    <li <if condition="!($k % 4)">class="item"</if> >

    <!-- <div class="bigk"></div> -->

    <div class="listbox clearfix">
      <!-- 圖片 -->
      <div class="listPic">
        <a rel="nofollow" target="_blank" href="{:U('/Home/Goods/goodsInfo',array('id'=>$v[goods_id]))}" >

          <if condition="$v.original_img1 neq ''">
            <img  style="display: block;" src="{$v.goods_id|goods_thum_images1=245,327}" dir="{$v.goods_id|goods_thum_images=245,327}" oldurl='{$v.goods_id|goods_thum_images1=245,327}' class="fn_img_lazy">
            <else />
            <img  style="display: block;" src="{$v.goods_id|goods_thum_images=245,327}" dir=""  oldurl='{$v.goods_id|goods_thum_images=245,327}' class="fn_img_lazy">
          </if>
        </a>
      </div>
      <div class="list-scroll J_scrollBox clearfix">
        <a href="javascript:void(0);" class="list-scroll-left cbtn"></a>
        <div class="list-scroll-warp J_hideBox">
          <dl class="J_mBox clearfix">

            <foreach name="goods_images" item="v2" key="k2">
              <if condition="$v2[goods_id] eq $v[goods_id]">
                <dd>
                  <a href="javascript:void(0);">
                    <img width="48"  height="64" data-img="{$v2[image_url]}" src="{$v2[image_url]}" style="display: block;">
                  </a>
                </dd>
              </if>
            </foreach>
          </dl>
        </div>
        <a href="javascript:void(0);" class="list-scroll-right cbtn"></a> </div>
      <div class="clear"></div>
      <!-- 品名 -->
      <div class="listDescript"> <a target="_blank" href="{:U('/Home/Goods/goodsInfo',array('id'=>$v[goods_id]))}" class="text13">{$bi,$v[goods_id]|goods_name_shift}<b>{$v[goods_sn]}</b></a> </div>


      <!-- 價格 -->
      <div class="discountPrice">
        <div class="price-cash">
          <span class="price_list"><if condition="($v[market_price] neq $v[shop_price]) AND ($v[market_price] gt $v[shop_price])" ><em>¥{$v[market_price]}</em> </if>¥{$v[shop_price]}</span>
          <del></del>
          <div class="morebtn_price">

            <if condition='$v.store_count eq 0'>
              <a href="javascript:;" class="morebtn1" style="background-color: #8A8A8A;" >{$Think.lang.outofstock} </a>
              <else/>
              <a href="javascript:;" class="morebtn1"  onClick="javascript:AjaxAddCart({$v[goods_id]},1,0);">{$Think.lang.addshoppingtrolley} </a>
            </if>
            <a href="javascript:;" class="morebtn2" onClick="collect_goods({$v.goods_id});">{$Think.lang.addbookmark} </a>
            <div class="clear"></div>
          </div>
        </div>
      </div>
      <!-- 價格 end-->
    </div>
    </li>
    <if condition="!(($k+1) % 4)"><div class="clear"></div></if>


  </foreach>
</ul>


<div class="clear"></div>
<script type="text/javascript">
    $(function(){
        // $('#header').css('left',($(window).width() / 2 - 642.5));
        $("#cata_choose_product li").hover(function(){
            var lazyimg = $(this).find(".fn_img_lazy").attr("dir");
            var src = $(this).find(".fn_img_lazy").attr("src");
            if(lazyimg)
            {
                $(this).find(".fn_img_lazy").attr("dir",src);
                $(this).find(".fn_img_lazy").attr("src",lazyimg);
            }
            $(this).find(".listbox ").addClass("bigk");
        },function(){

            var lazyimg = $(this).find(".fn_img_lazy").attr("dir");
            var src = $(this).find(".fn_img_lazy").attr("src");
            var oldurl = $(this).find(".fn_img_lazy").attr("oldurl");

            if(lazyimg)
            {
                $(this).find(".fn_img_lazy").attr("dir",src);
                $(this).find(".fn_img_lazy").attr("src",lazyimg);
            }
            $(this).find(".fn_img_lazy").attr("src",oldurl);
            $(this).find(".listbox ").removeClass("bigk");

        });


    });

</script>
<!-- Page -->
<div class="fn-page-css-1 pagintion fix" style="display: block;">
  <div class="pagenavi text12">{$page->show()}</div>
</div>
<!-- 商品列表 -->
</div>
</div>
<!--------中間內容end-------------->

<div id="goods_history" class="layout">
  <h3><i class="icon-star"></i>{$Think.lang.hotsale} </h3>
  <ul id="history_list">
    <tpshop sql="SELECT * FROM `__PREFIX__goods` where is_recommend=1 and is_on_sale=1 ORDER BY `goods_id` DESC limit 0,6" key="k" item='v'>
      <li ><a href="{:U('/Home/Goods/goodsInfo',array('id'=>$v[goods_id]))}" ><img src="{$v.goods_id|goods_thum_images=154,205}" ><span> {$bi,$v[goods_id],20|goods_name_shift}<b><if condition="($v[market_price] neq $v[shop_price]) AND ($v[market_price] gt $v[shop_price])" ><em>¥{$v[market_price]}</em> </if>¥ {$v[shop_price]}</b></span></a></li>

    </tpshop>
  </ul>
</div>
<!--------footer-開始-------------->
<include file="Public/footer" />
<!--------footer-結束-------------->
<script type="text/javascript">

    //############   分類導航折疊        ############
    $('span[name="submenuicon"]').each(function(){
        $(this).click(function(){
            if($(this).hasClass('menuplus')){
                $(this).removeClass('menuplus').addClass('menuminus');
                $(this).siblings('.second_div').find('ul').show();
            }else{
                $(this).removeClass('menuminus').addClass('menuplus');
                $(this).siblings('.second_div').find('ul').hide();
            }
        });
    })

    //############   更多類別屬性篩選       ###########
    $('.f-out-more').click(function(){
        $('.m-tr').each(function(i,o){
            if(i >  7){
                var attrdisplay = $(o).css('display');
                if(attrdisplay == 'none'){
                    $(o).css('display','block');
                }
                if(attrdisplay == 'block'){
                    $(o).css('display','none');
                }
            }
        });
        if($(this).hasClass('checked')){
            $(this).removeClass('checked tex-center').html('{$Think.lang.more}收起<i class="checked"></i>');
        }else{
            $(this).addClass('checked tex-center').html('{$Think.lang.moreoptions} ');
        }
    })
    $('.f-out-more').trigger('click').html('{$Think.lang.moreoptions} '); //  默認點擊壹下

    //############   更多條件選擇        ###########
    $('.f-more').click(function(){
        if($(this).hasClass('checked')){
            $(this).parent().siblings('ul').removeClass('z-show-more');
            $(this).removeClass('checked').html('{$Think.lang.more} <i></i>');
        }else{
            $(this).parent().siblings('ul').addClass('z-show-more');
            $(this).addClass('checked').html('{$Think.lang.put} <i class="checked"></i>');
        }
    })

    var cancelBtn = null;
    //############   多選框        ###########
    $('.f-check').click(function(){
        var _this = this;
        var st = 0;
        //關閉前壹個多選框
        if(cancelBtn != null){
            $(cancelBtn).parent().siblings('ul').removeClass('z-show-more');
            $(cancelBtn).parent().siblings('ul').find('li >a').each(function(i,o){
                $(o).removeClass('select selected');
                $(o).attr('href',$(o).data('href'));
                $(o).children('i').removeClass('selected').css('display','');
                $(o).unbind('click');
            });
            $(cancelBtn).parent().siblings('.f-ext').show().children('a').removeClass('checked');
            $(cancelBtn).parent().hide();
            $(cancelBtn).siblings().removeClass('u-confirm01');
        }
        cancelBtn = $(_this).parent().siblings('div').find('.u-cancel');

        //打開多選框
        $(_this).addClass('checked');
        $(_this).siblings().addClass('checked');
        $(_this).parent().siblings('.g-btns').show();
        $(_this).parent().siblings('ul').addClass('z-show-more');
        $(_this).parent().siblings('ul').find('li>a').each(function(i,o){
            $(o).addClass('select');
            $(o).children('i').css('display','inline');
            $(o).attr('href','javascript:;');
            $(o).bind('click',function(){
                if($(o).hasClass('selected')){
                    $(o).removeClass('selected');
                    $(o).children('i').removeClass('selected');
                    st--;
                }else{
                    $(o).addClass('selected');
                    $(o).children('i').addClass('selected');
                    $(_this).parent().siblings('.g-btns').children('.u-confirm').addClass('u-confirm01');
                    st++;
                }
                //如果沒有選中項,確定按鈕點不了
                if(st==0){
                    $(_this).parent().siblings('.g-btns').children('.u-confirm').removeClass('u-confirm01');
                }
            });
        });
        $(_this).parent().hide();
    })


    //############   取消多選        ###########
    $('.g-btns .u-cancel').each(function(){
        $(this).click(function(){
            $(this).parent().siblings('ul').removeClass('z-show-more');
            $(this).parent().siblings('ul').find('li >a').each(function(i,o){
                $(o).removeClass('select selected');
                $(o).attr('href',$(o).data('href'));
                $(o).children('i').removeClass('selected').css('display','');
                $(o).unbind('click');
            });
            $(this).parent().siblings('.f-ext').show().children('a').removeClass('checked');
            $(this).parent().hide();
            $(this).siblings().removeClass('u-confirm01');
        });
    })

    //############   產品圖片切換        ###########

    $('.list-scroll-warp').each(function(){
        var _this = this;

        $(_this).children().children().each(function(i,o){
            $(o).mouseover(function(){
                $(o).siblings().removeClass('cur');
                $(o).addClass('cur');
                var img_src = $(o).children().children().attr('data-img');
                //var imgold_src = $(_this).parent().siblings('.listPic').find('a').children().attr('src');
                $(_this).parent().siblings('.listPic').find('a').children().attr('src',img_src);
                //$(_this).parent().siblings('.listPic').find('a').children().attr('oldurl',imgold_src);
            })


        })
    })

    //############   點擊多選確定按鈕      ############
    // t 為類型  是品牌 還是 規格 還是 屬性
    // btn 是點擊的確定按鈕用於找位置
    get_parment = <?php echo json_encode($_GET); ?>;
    function submitMoreFilter(t,btn)
    {
        // 沒有被勾選的時候
        if(!$(btn).hasClass("u-confirm01"))
            return false;

        // 獲取現有的get參數
        var key = ''; // 請求的 參數名稱
        var val = new Array(); // 請求的參數值
        $(btn).parent().siblings(".f-list").find("li > a.selected").each(function(){
            key = $(this).data('key');
            val.push($(this).data('val'));
        });
        //parment = key+'_'+val.join('_');

        // 品牌
        if(t == 'brand')
        {
            get_parment.brand_id = val.join('_');
        }
        // 規格
        if(t == 'spec')
        {
            if(get_parment.hasOwnProperty('spec'))
            {
                get_parment.spec += '@'+key+'_'+val.join('_');
            }
            else
            {
                get_parment.spec = key+'_'+val.join('_');
            }
        }
        // 屬性
        if(t == 'attr')
        {
            if(get_parment.hasOwnProperty('attr'))
            {
                get_parment.attr += '@'+key+'_'+val.join('_');
            }
            else
            {
                get_parment.attr = key+'_'+val.join('_');
            }
        }
        // 組裝請求的url
        var url = '';
        for ( var k in get_parment )
        {
            url += "&"+k+'='+get_parment[k];
        }

        //console.log('get_parment',get_parment);
        location.href ="/index.php?m=Home&c=Goods&a=goodsList"+url;
    }

</script>
</body>
</html>